package com.arancia.codinglife.controller;

import com.arancia.codinglife.entity.Telephone;
import com.arancia.codinglife.service.TelephoneService;
import com.arancia.codinglife.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class TelephoneController {
	@Autowired
	private TelephoneService telephoneService;

	@RequestMapping(value = "/addTelephone", method = RequestMethod.POST)
	@ResponseBody
	CommonResult addTelephone(@RequestBody Telephone telephone) {
		CommonResult result = new CommonResult();
		try {
			// hi x
			// heihei
			// a
			// b
			telephoneService.addTelephone(telephone);
			result.setData(telephone);
			return result;
		} catch (Exception e) {
			result.setState(500);
			result.setMsg("ERROR");
			return result;
		}
	}
}
